package us.gaaoc.framework.webapp.backingbeans.admin;

 
import java.util.List;
import java.util.Map;

import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

import org.apache.log4j.Logger;
import org.hibernate.Hibernate;

import us.gaaoc.framework.businessmodel.Filing;
import us.gaaoc.framework.dao.ModelFacade;
import us.gaaoc.framework.dao.ModelFacadeHibernate; 
import us.gaaoc.framework.model.CaseRecord; 
import us.gaaoc.framework.webapp.backingbeans.BaseBackingBean;
 
/**
 * 
 * @author tapshals
 * @date May 24, 2006
 * @version: GAJE 1.5
 *
 */

public class ImportedFilingPage extends BaseBackingBean {
	
	/**
	 * Properties
	 */
	private DataModel importedFilingDataTable ;
	
	private Logger LOG = Logger.getLogger(ImportedFilingPage.class);

	 /**
	  * Constructor
	  *
	  */
	public ImportedFilingPage() {
		//load data   
		//type = childenforcement    status = imported
		List<Filing> newFilings = this.getModelFacade().findCaseFilingsByTypeAndStatus(1,2, (String) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("courtUuid"));	
		importedFilingDataTable = new ListDataModel();
		importedFilingDataTable.setWrappedData(newFilings);	 
	}

	/**
	 * Getter for property imoportedFilingDataTable
	 * @return importedFilingDataTable
	 */
	public DataModel getImportedFilingDataTable() {
		return importedFilingDataTable;
	}

	/**
	 * Setter for property importedFilingDataTable
	 * @param importedFilingDataTable
	 */
	public void setImportedFilingDataTable(DataModel importedFilingDataTable) {
		this.importedFilingDataTable = importedFilingDataTable;
	}

	/**
	 * This method navigates user to the Case Details Page
	 * @return String
	 */
	@SuppressWarnings("unchecked")
	public String gotoCaseDetailPage(){
		Map sessionMap = this.getFacesContext().getExternalContext().getSessionMap();
	 	Map requestMap = this.getFacesContext().getExternalContext().getRequestParameterMap();
	 	String caseUuid = ((String) requestMap.get("caseUuid"));
	 	sessionMap.put("caseUuid", caseUuid);
	 	sessionMap.put("from", "ImportedFilingPage");			
		return "gotoCSECaseDetailsPage";
	}
	
	/**
	 * This method navigates user to the Child Enforcement Case Type page
	 * @return String
	 */
	public String gotoChildEnforcementCaseTypePage() {
		return "gotoChildEnforcementCaseTypePage";
	}
 
	/**
	 * This method navigates user to the Case Record History Page
	 * @return String
	 */
	public String gotoHistoryPage() {
		Map sessionMap = this.getFacesContext().getExternalContext()
				.getSessionMap();
		Map requestMap = this.getFacesContext().getExternalContext()
				.getRequestParameterMap();
		String caseUuid = ((String) requestMap.get("caseUuid"));
		sessionMap.put("caseUuid", caseUuid);
		sessionMap.put("from", "ImportedFilingPage");
		return "gotoCaseHistoryPage";
	}
}
